
import {reqSearch,reqSearchList} from "@/api/index"
export default {
    state:{
        searchList:[],
         searchResult :[]
    },
    actions:{
        async getSearchList({commit}){
            const result = await reqSearch()
            if(result.code ===200){
                commit("SAVR_SEARCH", result.search.discover_list)
            }
        },
        async getSearchResult({commit}){
            const result = await reqSearchList()
            console.log(result)
            if(result.code ===200){
                commit("SAVR_SEARCH_RESULT", result.searchList.list)
            }
        },
    },
    mutations:{
        SAVR_SEARCH(state,list){
            state.searchList = list
        },
        SAVR_SEARCH_RESULT(state,list){
            state.searchResult = list
        }
    },
    getters:{}
}